package com.raymond.cmpp.common.utils;

import java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 * 线程池工具类
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-08-05 14:24
 */
public class ThreadPoolUtil {

    public static ScheduledThreadPoolExecutor getScheduledThreadExecutor(int corePoolSize, String threadName) {
        return new ScheduledThreadPoolExecutor(corePoolSize, r -> {
            Thread thread = new Thread(r);
            thread.setName(threadName);
            thread.setDaemon(true);
            return thread;
        });
    }
}
